*
* Creates a new #GdkContentFormats from an array of mime types.
*
- * The mime types must be different or the behavior of the return value
- * is undefined. If you cannot guarantee this, use #GdkContentFormatsBuilder
- * instead.
+ * The mime types must be valid and different from each other or the
+ * behavior of the return value is undefined. If you cannot guarantee
+ * this, use #GdkContentFormatsBuilder instead.
*
* Returns: (transfer full): the new #GdkContentFormats.
**/
return gdk_content_formats_new_take (NULL, 0, (const char **) g_ptr_array_free (array, FALSE), n_mime_types);
}
+/**
+ * gdk_content_formats_new_for_gtype:
+ * @type: a $GType
+ *
+ * Creates a new #GdkContentFormats for a given #GType.
+ *
+ * Returns: a new #GdkContentFormats
+ **/
+GdkContentFormats *
+gdk_content_formats_new_for_gtype (GType type)
+{
+ GType *data;
+
+ g_return_val_if_fail (type != G_TYPE_INVALID, NULL);
+
+ data = g_new (GType, 2);
+ data[0] = type;
+ data[1] = G_TYPE_INVALID;
+
+ return gdk_content_formats_new_take (data, 1, NULL, 0);
+}
+
/**
* gdk_content_formats_ref:
* @formats: a #GdkContentFormats
GdkContentFormats * gdk_content_formats_new (const char **mime_types,
guint n_mime_types);
GDK_AVAILABLE_IN_3_94
+GdkContentFormats * gdk_content_formats_new_for_gtype (GType type);
+GDK_AVAILABLE_IN_3_94
GdkContentFormats * gdk_content_formats_ref (GdkContentFormats *formats);
GDK_AVAILABLE_IN_3_94
void gdk_content_formats_unref (GdkContentFormats *formats);
gdk_content_provider_value_ref_formats (GdkContentProvider *provider)
{
GdkContentProviderValue *content = GDK_CONTENT_PROVIDER_VALUE (provider);
- GdkContentFormatsBuilder *builder;
- builder = gdk_content_formats_builder_new ();
- gdk_content_formats_builder_add_gtype (builder, G_VALUE_TYPE (&content->value));
- return gdk_content_formats_builder_free (builder);
+ return gdk_content_formats_new_for_gtype (G_VALUE_TYPE (&content->value));
}
static gboolean